import React from 'react';
import moment from 'moment';
class Introduction extends React.Component {
  constructor() {
    super();
    this.state = {
      timeShow: '',
    };
  }
  componentDidMount() {
    const { searchData } = this.props;
    this.setState({
      timeShow: moment(searchData?.date, 'YYYYMMDD').format('YYYY-MM-DD'),
    });
  }
  UNSAFE_componentWillReceiveProps(nextProps) {
    if (JSON.stringify(nextProps.searchData) != JSON.stringify(this.props.searchData)) {
      this.setState({
        timeShow: moment(nextProps.searchData?.date, 'YYYYMMDD').format('YYYY-MM-DD'),
      });
    }
  }
  render() {
    const { timeShow } = this.state;
    return (
      <div name={'syyh-pdf'} style={{ marginBottom: '16px' }}>
        <div style={{ position: 'relative', textAlign: 'center' }}>
          <span style={{ fontSize: '24px', fontWeight: 'bold' }}>商业银行监管报告</span>
          <span style={{ position: 'absolute', right: '0px', top: '8px' }}>{timeShow}</span>
        </div>
      </div>
    );
  }
}
export default Introduction;
